package com.anivia.system.service.controller;

import com.anivia.common.core.model.dto.IdsDTO;
import com.anivia.common.core.model.vo.R;
import com.anivia.system.service.model.dto.DictAddOrUpdateDTO;
import com.anivia.system.service.service.IDictInfoService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 字典表 前端控制器
 * </p>
 *
 * @author wangj
 */
@Slf4j
@RestController
@RequestMapping("api/dict")
public class DictInfoController {
    @Resource
    private IDictInfoService dictInfoService;

    @PostMapping("saveOrUpdate")
    private R saveOrUpdate(@RequestBody @Valid DictAddOrUpdateDTO dto) {
        dictInfoService.saveOrUpdate(dto);
        return R.ok();
    }

    @PostMapping("delete")
    private R delete(IdsDTO idsDTO) {
        dictInfoService.delete(idsDTO);
        return R.ok();
    }
}
